/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ecommerce.test;

/**
 *
 * @author Yoonan
 */
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class PageControl {

    /**
     * test for model attribute<br />
     * example <br />
     * http://localhost:8084/Pattern/testSession
     *
     * @param model
     * @return
     */
    @RequestMapping(value = "/testSession", method = RequestMethod.GET)
    public String printHello(ModelMap model) {
        model.addAttribute("message", "Hello Spring MVC Framework!");
        return "test/testSession";
    }

    /**
     * test for locale and properties<br />
     * example <br />
     * http://localhost:8084/Pattern/testProperty (defualt en)<br />
     * http://localhost:8084/Pattern/testProperty?lang=th_TH (thai)<br />
     * http://localhost:8084/Pattern/testProperty?lang=en (english)<br />
     *
     * @param model
     * @return
     */
    @RequestMapping(value = "/testProperty", method = RequestMethod.GET)
    public String printProperties(ModelMap model) {
        return "test/testProperty";
    }
    
    @RequestMapping(value = "/testUploadMultiplefile", method = RequestMethod.GET)
    public String uploadMultiple(ModelMap model) {
        return "upload/uploadMultipleFile";
    }
    
    @RequestMapping(value = "/testUploadSinglefile", method = RequestMethod.GET)
    public String uploadSingle(ModelMap model) {
        return "upload/uploadSingleFile";
    }

//    @RequestMapping(value = "/", method = RequestMethod.GET)
//    public String home(ModelMap model) {
//        return "index";
//    }
}
